<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加信息</title>
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
</head>
<body>
<div align="center">
    <h1>添加客户信息</h1>
    <a href="list.html">客户信息列表</a><br/>
    <a href="index.html">登录页</a><br/>
    <input type="text" id="c_name" placeholder="请输入姓名"><br>
    <input type="text" id="c_telephone" placeholder="请输入电话"><br>
    <input type="text" id="c_address" placeholder="请输入地址"><br>
    <input type="text" id="c_remark" placeholder="请输入备注"><br>
    <input type="submit" id="submit" placeholder="保存"><br>
</div>
</body>
<script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>

<script>
    $(function () {
       $("#submit") .click(function () {
           let c = {};
           c.c_name = $("#c_name").val();
           c.c_telephone = $("#c_telephone").val();
           c.c_address = $("#c_address").val();
           c.c_remark = $("#c_remark").val();
           $.ajax({
               url:'/customer/add',
               type:'post',
               dataType:'json',
               contentType:'application/json',
               data:JSON.stringify(c),
               success:function (data) {
                   if(data.success){
                       $.toast("添加成功");
                   }else {
                       $.toast(data.errMsg);
                   }
               }
           });
       });
    })
</script>
</html>